package spring.cloud.eurekaclientfund.controller;

import com.spring.cloud.commonutils.vo.ResultMessage;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;


/**
 * @author Administrator
 */
@RestController
@RequestMapping("/fund")
public class AccountController {

    /**
     * @param userId
     * @param amount
     * @param request
     * @return
     */
    @PostMapping("/account/balance/{userId}/{amount}")
    public ResultMessage deductingBalance(
            @PathVariable("userId") Long userId,
            @PathVariable("amount") Double amount,
            HttpServletRequest request
    ){
        String message = "端口：【"+request.getServerPort()+"】扣减成功";
        ResultMessage result = new ResultMessage(true,message);
        return result;
    }
}
